package model

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Username string `gorm:"type:varchar(50)" json:"username"`
	Password string `gorm:"type:varchar(255)" json:"password"`
	Tel      string `gorm:"type:char(11)" json:"tel"`
	Email    string `gorm:"type:varchar(255)" json:"email"`
}
type Good struct {
	gorm.Model
	Name     string  `gorm:"type:varchar(50)" json:"name"`
	Price    float64 `gorm:"type:decimal(10,2)" json:"price"`
	Status   string  `gorm:"type:varchar(255)" json:"status"`
	Stock    int64   `gorm:"type:int" json:"stock"`
	Total    float64 `gorm:"type:decimal(10,2)" json:"total"`
	Quantity int64   `gorm:"type:varchar(255)" json:"quantity"`
}

func (g *Good) GoodAdd(db *gorm.DB, goodID int) error {
	return db.Where("id=?", goodID).Create(&g).Error
}
